<template>
	<view class="">
		<view class="topBg">
		</view>
		<view id="main">
			<view class="swiperview">
				<swiper class="swiper" :indicator-dots="true" :autoplay="false" :interval="3000" :duration="1000">
					<swiper-item class="item">
						<view class="swiper-item">
							<image src="../../static/center/topBg.png" mode="" class="pic"></image>
						</view>
					</swiper-item>
					<swiper-item class="item">
						<view class="swiper-item">
							<image src="../../static/center/topBg.png" mode="" class="pic"></image>
						</view>
					</swiper-item>
				</swiper>
			</view>
			<!-- 金刚区 -->
			<view class="menu">
				<view class="top">
					<view class="item" v-for="item in navigation" :key="item.id">
						<image :src="item.imageSrc" mode="" class="pic"></image>
						<text class="text">{{item.name}}</text>
					</view>
				</view>
			</view>
			<!-- 文字 -->
			<view id="message">
				<text class="left-text">A股 实时金价格</text>
				<text>373.00</text>
				<text>-4.9 -1.19%</text>
			</view>
			<!-- 财富直通车 -->
			<view id="wealth">
				<text class="comm-title">财富直通车</text>
				<view class="content">
					<view class="left">
						<text>{{wealth[0].title}}</text>
						<text>{{wealth[0].desc}} </text>
						<text>{{wealth[0].bigText}}!</text>
						<text>{{wealth[0].startToEnd}}</text>
						<button >立即参与></button>
					</view>
					<view class="right">
						<view class="item">
							<text>{{wealth[1].title}}</text>
							<text>{{wealth[1].desc}}</text>
							<button size="mini">立即抢购></button>
						</view>
						<view class="item">
							<text>{{wealth[2].title}}</text>
							<text>{{wealth[2].desc}}</text>
							<button size="mini">立即抢购></button>
						</view>
					</view>
				</view>
			</view>
			<!-- 财富头条 -->
			<view id="headline">
				<text class="comm-title">财富头条</text>
				<view class="content">
					<view class="headline-left">
						
					</view>
					<view class="headline-right">
						
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				navigation: [],
				wealth:[]
			}
		},
		onLoad() {
			this.getNavigation();
			this.getFortunehead();
			this.getFortunecar();
			// console.log(getApp().globalData);
		},
		methods: {
			// 获取首页导航
			async getNavigation() {
				const res = await this.$http.center.getNavigationInfo();
				if (res.code == 200) {
					this.navigation = res.data
				}
			},
			// 财富直通车
			async getFortunecar(){
				const res = await this.$http.center.getFortunecar();
				if (res.code == 200) {
					this.wealth=res.data;
				}
			},
			async getFortunehead() {
				const res = await this.$http.center.getFortuneheadlines({
					pageNum: 0,
					pageSize: 0,
					username: ""
				})
				if (res.code == 200) {
					console.log(res);
				}
			}
		},
		// token判断登录页需要登录
		
	}
</script>

<style lang="scss" scoped>
	#main {
		padding: 24rpx;
	}

	.topBg {
		width: 100%;
		height: 200rpx;
		background-color: #3476f1;
	}

	.swiperview {
		width: 100%;
		height: 140rpx;
	}

	.swiper {
		position: absolute;
		width: 702rpx;
		top: 76rpx;
		height: 240rpx;

		.swiper-item {
			.pic {
				height: 240rpx;
				// width: 100%;
				width: 702rpx;
			}
		}
	}

	.menu {
		.top {
			display: flex;
			flex-wrap: wrap;
			justify-content: space-around;

			.item {
				width: 140rpx;
				display: flex;
				flex-direction: column;
				align-items: center;
				margin-top: 30rpx;

				.pic {
					width: 88rpx;
					height: 88rpx;
				}

				.text {
					margin-top: 18rpx;
					font-size: 24rpx;
					color: #666666;
				}
			}
		}
	}
#message{
	margin-top: 40rpx;
	height: 80rpx;
	box-shadow: 0px 0px 5px #ececec;
	padding-left: 34rpx;
	padding-right: 34rpx;
	line-height: 80rpx;
	font-size: 28rpx;
	.left-text{
		color: #666666;
	}
	text:nth-child(2){
		color: #f85656;
		margin-left: 24rpx;
	}
	text:nth-child(3){
		color: #f85656;
		float: right;
	}
}
// 财富直通车
.comm-title{
	font-size: 36rpx;
	margin-left: 24rpx;
	height: 40rpx;
	position: relative;
	font-weight: bold;
	&::before{
		content: "";
		display: inline-block;
		width: 10rpx;
		height: 34rpx;
		background-color: #3476fe;
		margin-right: 20rpx;
		position: absolute;
		left: -24rpx;
		top: 8rpx;
		border-radius: 8rpx;
	}
}
#wealth{
	margin-top: 40rpx;
	.content{
		margin-top: 24rpx;
		height: 400rpx;
		display: flex;
		.left{
			padding: 28rpx;
			margin-right: 20rpx;
			box-sizing: border-box;
			width: 350rpx;
			height: 100%;
			border-radius: 15rpx;
			background-image: url(../../static/center/wealth-left.png);
			background-size: cover;
			color: white;
			display: flex;
			flex-direction: column;
			position: relative;
			text:nth-child(1){
				font-size: 40rpx;
				margin-bottom: 24rpx;
				font-weight: 510;
			}
			text:nth-child(2){
				font-size: 28rpx;
				margin-bottom: 10rpx;
			}
			text:nth-child(3){
				font-size: 32rpx;
				color: #be7f22;font-weight: 600;
				margin-bottom: 30rpx;

			}
			text:nth-child(4){
				font-size: 28rpx;
				color: #ffeed2;
			}
			button{
				width: 190rpx;
				height: 64rpx;
				border: none;
				font-size: 28rpx;
				background-color: #ff7846;
				color: white;
				border-radius: 40rpx;
				line-height: 64rpx;
				margin-top: 40rpx;
				margin-left: -10rpx;
				// line-height: 180rpx;
			}
		}
		.right{
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			height: 400rpx;
			width: 332rpx;
			.item{
				height: 190rpx;
				// flex-grow: 1;
				border-radius: 15rpx;
				background-color: red;
				background-size: cover;
				box-sizing: border-box;
				padding-left: 24rpx;
				padding-top: 20rpx;
				color: white;
				display: flex;
				flex-direction: column;
				&:nth-child(1){
					background-image: url(../../static/center/wealth3.png);
					text{
						&:nth-child(2){
							font-size: 24rpx;
							color: #e5e5f5;
						}
					}
				}
				&:nth-child(2){
					background-image: url(../../static/center/wealth2.png);
					text{
						&:nth-child(2){
							font-size: 24rpx;
							color: #dcfffa;
						}
					}
				}
				text{
					&:nth-child(1){
						font-size: 28rpx;
					}
				}
				button{
					width: 174rpx;
					height: 48rpx;
					background-color: #ff7846;
					color: white;
					font-size: 23rpx;
					border-radius: 40rpx;
					line-height: 48rpx;
					margin-left: -10rpx;
					margin-top: 30rpx;
					
				}
			}
		}
	}
}
// 财富头条
#headline{
	margin-top: 40rpx;
	.content{
		height: 284rpx;
		box-shadow: 0px 0px 5px #ececec;
		box-sizing: border-box;
		padding: 24rpx;
		
	}
}
</style>
